//
//  myCollectCell.m
//  spotrs
//
//  Created by sky on 16/5/17.
//  Copyright © 2016年 TZ. All rights reserved.
//

#import "myCollectCell.h"

@implementation myCollectCell{
    UILabel *_collecttime;
    UILabel *_collectstate;
    UILabel *_productmoney;
    UILabel *_collectplace;
    UILabel *_collecttype;
    UILabel *_adress;
    UILabel *_date;
    UILabel *_yudingtime;
    UILabel *_changdi;
    UILabel *_teacher;
    UILabel *_money;
}

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // Initialization code
        [self buildLayout];
    }
    return self;
}

-(void)buildLayout{
    UIView *firstbgvi = [[UIView alloc]initWithFrame:CGRectMake(0, 5/3, SCREEN_WIDTH, 280/3)];
    firstbgvi.backgroundColor = [UIColor whiteColor];
    [self.contentView addSubview:firstbgvi];
    
    UIView *secbgvie = [[UIView alloc]initWithFrame:CGRectMake(0, firstbgvi.frame.origin.y + firstbgvi.frame.size.height + 10, SCREEN_WIDTH, 884 / 3 - 5/3 - 10/3 - 280/3)];
    secbgvie.backgroundColor = [UIColor whiteColor];
    [self.contentView addSubview:secbgvie];
    
   
    UILabel *colltime = [self LabelWithRect:CGRectMake(15, 15, 15 * 4 + 13, 15) textColor:[LCCommon getColor:@"ebebeb"] textstr:@"收藏时间 :" textfont:15 textstyle:NSTextAlignmentLeft];
    [firstbgvi addSubview:colltime];
    
    UILabel *state = [self LabelWithRect:CGRectMake(15, colltime.frame.origin.y + 15 + 10, colltime.frame.size.width, 15) textColor:[LCCommon getColor:@"ebebeb"] textstr:@"收藏状态 :" textfont:15 textstyle:NSTextAlignmentLeft];
    [firstbgvi addSubview:state];
    
    UILabel *promoney = [self LabelWithRect:CGRectMake(15, state.frame.origin.y + 15 + 10, state.frame.size.width, 15) textColor:[LCCommon getColor:@"ebebeb"] textstr:@"产品金额 :" textfont:15 textstyle:NSTextAlignmentLeft];
    [firstbgvi addSubview:promoney];
    
    _collecttime = [self LabelWithRect:CGRectMake(colltime.frame.size.width + colltime.frame.origin.x, 15, SCREEN_WIDTH - (colltime.frame.size.width + colltime.frame.origin.x), 15) textColor:[LCCommon getColor:@"000000"] textstr:@"2015-12-18 10:52:59" textfont:15 textstyle:NSTextAlignmentLeft];
    [self.contentView addSubview:_collecttime];
    
    _collectstate = [self LabelWithRect:CGRectMake(state.frame.size.width + state.frame.origin.x, state.frame.origin.y, SCREEN_WIDTH - (state.frame.size.width + state.frame.origin.x), 15) textColor:[LCCommon getColor:@"000000"] textstr:@"已收藏(已预约)" textfont:15 textstyle:NSTextAlignmentLeft];
    [firstbgvi addSubview:_collectstate];
    
    _productmoney = [self LabelWithRect:CGRectMake(_collectstate.frame.origin.x, promoney.frame.origin.y, SCREEN_WIDTH - (promoney.frame.origin.x + promoney.frame.size.width), 15) textColor:[LCCommon getColor:@"000000"] textstr:@"170.00" textfont:15 textstyle:NSTextAlignmentLeft];
    [firstbgvi addSubview:_productmoney];
    
    
    UIView *line = [self makeLinewithRect:CGRectMake(0, 110/3, SCREEN_WIDTH, .5) Color:[UIColor orangeColor] addview:secbgvie];
    
    
    UILabel *collectqiu = [self LabelWithRect:CGRectMake(15, 10, colltime.frame.size.width, 15) textColor:[LCCommon getColor:@"ebebeb"] textstr:@"收藏球馆 :" textfont:15 textstyle:NSTextAlignmentLeft];
    [secbgvie addSubview:collectqiu];
    
    _collectplace = [self LabelWithRect:CGRectMake(collectqiu.frame.origin.x + collectqiu.frame.size.width, collectqiu.frame.origin.y, SCREEN_WIDTH - (collectqiu.frame.origin.x + collectqiu.frame.size.width), 15) textColor:[LCCommon getColor:@"000000"] textstr:@"北京市朝阳区工人体育馆" textfont:15 textstyle:NSTextAlignmentLeft];
    [secbgvie addSubview:_collectplace];
    
    
    UILabel *type = [self LabelWithRect:CGRectMake(15, line.frame.origin.y + 8, 15 * 2 + 13, 15) textColor:[LCCommon getColor:@"ebebeb"] textstr:@"类型 :" textfont:15 textstyle:NSTextAlignmentLeft];
    [secbgvie addSubview:type];
    
    
    UILabel *adre = [self LabelWithRect:CGRectMake(15, type.frame.origin.y + 3 + 15, type.frame.size.width, 15) textColor:[LCCommon getColor:@"ebebeb"] textstr:@"地址 :" textfont:15 textstyle:NSTextAlignmentLeft];
    [secbgvie addSubview:adre];
    
    
    UILabel *riqi = [self LabelWithRect:CGRectMake(15, adre.frame.origin.y + 3 + 15, adre.frame.size.width, 15) textColor:[LCCommon getColor:@"ebebeb"] textstr:@"日期 :" textfont:15 textstyle:NSTextAlignmentLeft];
    [secbgvie addSubview:riqi];
    
    
    _collecttype = [self LabelWithRect:CGRectMake(type.frame.origin.x + type.frame.size.width, type.frame.origin.y,SCREEN_WIDTH - (type.frame.origin.x + type.frame.size.width), 15) textColor:[LCCommon getColor:@"000000"] textstr:@"网球" textfont:15 textstyle:NSTextAlignmentLeft];
    [secbgvie addSubview:_collecttype];
    
    
    _adress = [self LabelWithRect:CGRectMake(_collecttype.frame.origin.x, _collecttype.frame.origin.y + 3 + 15, _collecttype.frame.size.width, 15) textColor:[LCCommon getColor:@"000000"] textstr:@"北京工人体育馆" textfont:15 textstyle:NSTextAlignmentLeft];
    [secbgvie addSubview:_adress];
    
    
    _date = [self LabelWithRect:CGRectMake(_adress.frame.origin.x, _adress.frame.origin.y + 3 + 15, _adress.frame.size.width, 15) textColor:[LCCommon getColor:@"000000"] textstr:@"2015-12-29" textfont:15 textstyle:NSTextAlignmentLeft];
    [secbgvie addSubview:_date];
    
    UILabel *yudi = [self LabelWithRect:CGRectMake(8, riqi.frame.origin.y + 15 + 10, 4 * (SCREEN_WIDTH - 40)/11, 80/3) textColor:[UIColor whiteColor] textstr:@"预订时间" textfont:15 textstyle:NSTextAlignmentCenter];
    yudi.backgroundColor = [UIColor orangeColor];
    [secbgvie addSubview:yudi];
    
    UILabel *qiuchang = [self LabelWithRect:CGRectMake(yudi.frame.origin.x + yudi.frame.size.width + 8, yudi.frame.origin.y , 2 * (SCREEN_WIDTH - 40)/11, 80/3) textColor:[UIColor whiteColor] textstr:@"场地" textfont:15 textstyle:NSTextAlignmentCenter];
    qiuchang.backgroundColor = [UIColor orangeColor];
    [secbgvie addSubview:qiuchang];
    
    
    UILabel *jiaolian = [self LabelWithRect:CGRectMake(qiuchang.frame.origin.x + qiuchang.frame.size.width + 8, qiuchang.frame.origin.y, 2 * (SCREEN_WIDTH - 40)/11, 80/3) textColor:[UIColor whiteColor] textstr:@"教练" textfont:15 textstyle:NSTextAlignmentCenter];
    jiaolian.backgroundColor = [UIColor orangeColor];
    [secbgvie addSubview:jiaolian];
    
    
    UILabel *zongjiage = [self LabelWithRect:CGRectMake(jiaolian.frame.origin.x + jiaolian.frame.size.width + 8, jiaolian.frame.origin.y, 3 * (SCREEN_WIDTH - 40)/11, 80/3) textColor:[UIColor whiteColor] textstr:@"总价格" textfont:15 textstyle:NSTextAlignmentCenter];
    zongjiage.backgroundColor = [UIColor orangeColor];
    [secbgvie addSubview:zongjiage];
    
    
    _yudingtime = [self LabelWithRect:CGRectMake(yudi.frame.origin.x, yudi.frame.origin.y + yudi.frame.size.height ,yudi.frame.size.width, yudi.frame.size.height) textColor:[LCCommon getColor:@"000000"] textstr:@"14:50-15:00" textfont:15 textstyle:NSTextAlignmentCenter];
    [secbgvie addSubview:_yudingtime];
    
    
    _changdi = [self LabelWithRect:CGRectMake(qiuchang.frame.origin.x, qiuchang.frame.origin.y + qiuchang.frame.size.height, qiuchang.frame.size.width, qiuchang.frame.size.height) textColor:[LCCommon getColor:@"000000"] textstr:@"4号" textfont:15 textstyle:NSTextAlignmentCenter];
    [secbgvie addSubview:_changdi];
    
    
    _teacher = [self LabelWithRect:CGRectMake(jiaolian.frame.origin.x, jiaolian.frame.origin.y + jiaolian.frame.size.height, jiaolian.frame.size.width, jiaolian.frame.size.height) textColor:[LCCommon getColor:@"000000"] textstr:@"ccc" textfont:15 textstyle:NSTextAlignmentCenter];
    [secbgvie addSubview:_teacher];
    
    
    _money = [self LabelWithRect:CGRectMake(zongjiage.frame.origin.x, zongjiage.frame.origin.y + zongjiage.frame.size.height, zongjiage.frame.size.width, zongjiage.frame.size.height) textColor:[LCCommon getColor:@"000000"] textstr:@"170.0元" textfont:15 textstyle:NSTextAlignmentCenter];
    [secbgvie addSubview:_money];
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}



-(UILabel *)LabelWithRect:(CGRect)rect textColor:(UIColor *)color textstr:(NSString *)str textfont:(int)font textstyle:(NSTextAlignment)aligment{
    UILabel *label = [[UILabel alloc] initWithFrame:rect];
    label.textColor = color;
    label.text = str;
    label.font = [UIFont systemFontOfSize:font];
    label.textAlignment = aligment;
    label.numberOfLines = 0;
    return label;
}

-(UIView *)makeLinewithRect:(CGRect)rect Color:(UIColor *)color addview:(UIView *)vi{
    UIView *line = [[UIView alloc]initWithFrame:rect];
    line.backgroundColor = color;
    [vi addSubview:line];
    return line;
}

@end
